/**
 *  @author: yaoyuan
 *  Description: User Table
 *  created: 2014.08.29
 **/

import mongoose, {Schema} from 'mongoose';
import {CommInfo, CommConf} from './Base';
let utils = global.utils;

/**
 * [schema description]
 * @type {Schema}
 */
let schema = new Schema({
   username: String,
   password: {type: String, set: function(val){
    return utils.md5(val);  
   }},
   email: String,
   phone: String
});

//  Disable the behavior by setting the autoIndex option of your schema to false.
schema.set('autoIndex', false);

//schema.plugin(commInfo);

let table = mongoose.model(CommConf.tableName('user'), schema);	

//  模块接口
module.exports = table;